<extend name="Public:base"/>
<block name="title"> 武汉同兴一站办企业服务有限公司 管理中心 - 地区添加 </block>

<block name="header">
    <span class="action-span"><a href="#">地区添加</a></span>
    <span class="action-span1"><a href="#">武汉同兴一站办企业服务有限公司 管理中心</a></span>
    <!--<span id="search_id" class="action-span1"> - 添加分类 </span>-->
    <div style="clear:both"></div>
</block>
<block name="body">

    <form action="" method="post" name="theForm" enctype="multipart/form-data">
        <table width="100%" id="general-table">

            <tr>
                <td class="label">省(直辖市):</td>
                <td>
                    <select name="province" onchange="province_f(this)">
                        <option value="0">|--请选择省</option>
                        <volist name="cate" id="vo">
                            <option name="province"  value="{$vo.region_id}">
                                {$vo.lev|str_repeat="--",###}{$vo.region_name}
                            </option>
                        </volist>
                    </select>
                </td>
            </tr>

            <tr>
                <td class="label">市:</td>
                <td>
                    <select name="city" id="subordinate">


                    </select>
                </td>
            </tr>

        </table>
        <div class="button-div">
            <input type="submit" value=" 确定 " />
            <input type="reset" value=" 重置 " />
        </div>
    </form>
    <script type="text/javascript" src="/public/Admin/JS/jquery.min.js"></script>
    <script>

      function  province_f(that){
          //alert($(that).val());
          id = $(that).val();
          $.ajax({
              url:"{:U('Area/subordinate')}",
              type:'post',
              data:{'id':id},
              success:function(data){
                  $data = JSON.parse(data);
                  //console.log($data);
                  if($data.state == 200){
                     arr = $data.rel;
                      console.log(arr);
                     var  html =   '<option value="0">|--请选择市</option>'
                      $("#subordinate").append( html );
                      for(var i=0;i<arr.length;i++) {
                         var html1= '<option name="city"  value="'+arr[i].region_id+'">'+arr[i].region_name +  '</option>'
                          $("#subordinate").append( html1 );
                      }

                  }

              }
          });
      }
    </script>
</block>

